<template>
  <div id="app">
    <div id="nav">
      <el-menu :default-active="path" class="menu" mode="horizontal" @select="navSelect">
        <el-menu-item index ="/">首页</el-menu-item>
        <el-menu-item index ="/news">新闻</el-menu-item>
      </el-menu>

    </div>
    <router-view></router-view>
  </div>
</template>
<script>
export default {
  name: "App",
  mounted() {
    //向后端请求数据

  },
  data()
  {
    return{
      path: '1',



    }
  },
  methods:
  {
    navSelect(path){
      this.$router.push(path);

    },
  }
}
</script>



<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
